//go:build !linux
// +build !linux

package goroutinepool

import (
	"fmt"
	"runtime"
)

// setCPUAffinity 在非Linux系统上，只锁定到OS线程（有限的CPU亲和性）
func setCPUAffinity(cpu int) error {
	if cpu < 0 || cpu >= runtime.NumCPU() {
		return fmt.Errorf("invalid CPU core: %d (available: 0-%d)", cpu, runtime.NumCPU()-1)
	}

	// 在非Linux系统上，我们只能锁定goroutine到OS线程
	// 无法直接设置CPU亲和性
	runtime.LockOSThread()

	fmt.Printf("[WARNING] CPU affinity not fully supported on this platform. Goroutine locked to OS thread.\n")
	return nil
}
